
cmake_minimum_required(VERSION 3.5.1)

project(maven-search LANGUAGES CXX VERSION 0.2)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5 COMPONENTS Core Widgets Network)

# 头文件目录
include_directories()

# 资源文件路径
set(QRC_SOURCES "")

add_subdirectory(NetworkRequest)
add_subdirectory(MavenSearch)
add_subdirectory(MavenPackageWidget)

add_executable(${PROJECT_NAME} "main.cpp"
    "mainwindow.cpp" "mainwindow.h" 
    ${QRC_SOURCES}
)

target_include_directories(${PROJECT_NAME} PRIVATE
    ${NetworkRequest_INCLUDE_DIRS}
    ${MavenSearch_INCLUDE_DIRS}
    ${MavenPackageWidget_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Network
    ${NetworkRequest_LIBRARIES}
    ${MavenSearch_LIBRARIES}
    ${MavenPackageWidget_LIBRARIES}
)

# 设置安装路径的前缀(默认为"/usr/local")
set(CMAKE_INSTALL_PREFIX "/opt")

# 设置执行 make install 时哪个目标应该被 install 到哪个位置
install(TARGETS ${PROJECT_NAME} 
    DESTINATION share/youwant/maven-search) 

install(FILES maven-logo-black-on-white.png
    DESTINATION share/youwant/maven-search/icon) 

install(FILES maven-search.desktop
    DESTINATION share/applications)

find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR})
add_package_descript(cmake/package-deb.descript)